using System;
using System.Collections.Generic;


namespace LiveCS.Models
{
	[Serializable]
	public class Teamgroup: IEquatable<Teamgroup>
	{

		#region Private Members

		private string _classid; 
		private IList<Historyfightingmember> _HistoryfightingmemberList; 
		private IList<Teaminformation> _TeaminformationList; 
		private int _gamestate; 
		private int _remaincount; 		
		#endregion

		#region Constructor

		public Teamgroup()
		{
			_classid = String.Empty; 
			_HistoryfightingmemberList = new List<Historyfightingmember>(); 
			_TeaminformationList = new List<Teaminformation>(); 
			_gamestate = 0; 
			_remaincount = 0; 
		}
		#endregion // End of Default ( Empty ) Class Constuctor

		#region Required Fields Only Constructor
		/// <summary>
		/// required (not null) fields only constructor
		/// </summary>
		public Teamgroup(
			string classid)
			: this()
		{
			_classid = classid;
			_gamestate = 0;
			_remaincount = 0;
		}
		#endregion // End Constructor

		#region Public Properties
			
		public virtual string Classid
		{
			get
			{ 
				return _classid;
			}

			set	
			{	
				if( value == null )
					throw new ArgumentOutOfRangeException("Null value not allowed for Classid", value, "null");
				
				if(  value.Length > 20)
					throw new ArgumentOutOfRangeException("Invalid value for Classid", value, value.ToString());
				
				_classid = value;
			}
		}
			
		public virtual IList<Historyfightingmember> HistoryfightingmemberList
		{
			get
			{
				return _HistoryfightingmemberList;
			}
			set
			{
				_HistoryfightingmemberList = value;
			}
		}

		public virtual IList<Teaminformation> TeaminformationList
		{
			get
			{
				return _TeaminformationList;
			}
			set
			{
				_TeaminformationList = value;
			}
		}

		public virtual int GameState
		{
			get
			{ 
				return _gamestate;
			}
			set
			{
				_gamestate = value;
			}

		}
			
		public virtual int RemainCount
		{
			get
			{ 
				return _remaincount;
			}
			set
			{
				_remaincount = value;
			}

		}
			
				
		#endregion 

		#region Public Functions

		public virtual void AddHistoryfightingmember(Historyfightingmember obj)
		{
			#region Check if null
			if (obj == null)
				throw new ArgumentNullException("obj", "El parametro no puede ser nulo");
			#endregion
			_HistoryfightingmemberList.Add(obj);
		}
		

		public virtual void AddTeaminformation(Teaminformation obj)
		{
			#region Check if null
			if (obj == null)
				throw new ArgumentNullException("obj", "El parametro no puede ser nulo");
			#endregion
			_TeaminformationList.Add(obj);
		}
		

		#endregion //Public Functions

		#region Equals And HashCode Overrides
		/// <summary>
		/// local implementation of Equals based on unique value members
		/// </summary>
		public override bool Equals( object obj )
		{
			if( this == obj ) return true;
			if( ( obj == null ) || ( obj.GetType() != this.GetType() ) ) return false;
			Teamgroup castObj = (Teamgroup)obj; 
			return ( castObj != null ) &&
				( this._classid == castObj.Classid );
		}
		
		/// <summary>
		/// local implementation of GetHashCode based on unique value members
		/// </summary>
		public override int GetHashCode()
		{
			
			int hash = 57; 
			hash = 27 ^ hash ^ _classid.GetHashCode();
			return hash; 
		}
		#endregion
		
		#region IEquatable members

		public bool Equals(Teamgroup other)
		{
			if (other == this)
				return true;
		
			return ( other != null ) &&
				( this._classid == other.Classid );
				   
		}

		#endregion
		
	}
}
